﻿package frEngine.loaders.particleSub
{
    import frEngine.loaders.particleSub.particleInstance.*;

    public class SkyEmitter extends EmitterObject
    {
        private var _H:Number = 0;
        private var _W:Number = 0;
        private var dx:Number;
        private var dy:Number;

        public function SkyEmitter(param1:String, param2:int, param3:int)
        {
            var _loc_4:int = 2048;
            param2 = 2048;
            var _loc_4:int = 1024;
            param3 = 1024;
            this.initWH(param2, param3);
            super(param1, null);
            return;
        }// end function

        override public function get meshData() : MeshBase
        {
            if (!_meshData && !hasDisposed)
            {
                _meshData = new PlaneParticle(this._W, this._H, "+xy");
            }
            return _meshData;
        }// end function

        private function initWH(param1:int, param2:int) : void
        {
            this._W = param1;
            this._H = param2;
            this.dx = this._W / 2;
            this.dy = this._H / 2;
            return;
        }// end function

        public function getBirthCountRate() : Number
        {
            return Math.max(Math.min(this._W * this._H / (2048 * 1024), 1), 0);
        }// end function

        private function processOffset() : void
        {
            return;
        }// end function

        override protected function processAxis(param1:int) : void
        {
            _vect3d.x = 0;
            _vect3d.y = 0;
            this.processOffset();
            return;
        }// end function

        override protected function processCurve(param1:int) : void
        {
            var _loc_2:* = randnomArr0[param1];
            var _loc_3:* = randnomArr1[param1];
            _vect3d.x = this._W * 0.5 - this._W * _loc_2;
            _vect3d.y = this._H * 0.5 - this._H * _loc_3;
            this.processOffset();
            return;
        }// end function

        override protected function processEdage(param1:int) : void
        {
            var _loc_2:* = randnomArr0[param1];
            var _loc_3:* = randnomArr1[param1];
            var _loc_4:* = randnomArr2[param1];
            if (_loc_2 < 0.5)
            {
                _vect3d.x = this._W * 0.5 - this._W * _loc_3;
                _vect3d.y = _loc_4 < 0.5 ? (-this.dy) : (this.dy);
            }
            else
            {
                _vect3d.y = this._H * 0.5 - this._H * _loc_3;
                _vect3d.x = _loc_4 < 0.5 ? (-this.dx) : (this.dx);
            }
            this.processOffset();
            return;
        }// end function

        override protected function processVertex(param1:int) : void
        {
            var _loc_2:* = randnomArr0[param1];
            var _loc_3:* = randnomArr1[param1];
            _vect3d.x = _loc_2 < 0.5 ? (-this.dx) : (this.dx);
            _vect3d.y = _loc_3 < 0.5 ? (-this.dy) : (this.dy);
            this.processOffset();
            return;
        }// end function

        override protected function processVolume(param1:int) : void
        {
            this.processCurve(param1);
            return;
        }// end function

    }
}
